#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main (int argc, char const* argv[])
{
    int m, t, d, f, u, sum, i, a[100000];
    for (i = 0; i < 100000; i++) {
        a[i] = 0;
    }

    srand((int)time(0));

    t = rand() % 100000 + 1;
    d = rand() % 100 + 1;
    f = rand() % d + 1;
    u = rand() % f + 1;

    sum = 0;
    for (i = 0; i < t; i++) {
        a[i] = rand() % 3;
        if (a[i] == 0) {
            sum += 2 * f;
        } else {
            sum += d + u;
        }
    }

    m = rand() % sum;
    printf("%d %d %d %d %d\n", m, t, u, f, d);
    for (i = 0; i < t; i++) {
        if (a[i] == 0) {
            printf("f\n");
        } else if (a[i] == 1) {
            printf("u\n");
        } else {
            printf("d\n");
        }
    }

    return 0;
}
